var index = 0;
function login(){
	if(index==1){
		return false;
	}
	index = 1;
	var username = jQuery("#name").val();
	var password = jQuery("#password").val();

  	if(username=='用户名/手机号'||username==''){
  		jQuery(".error").show(200);
  		jQuery(".error span").html('&nbsp;用户名不能为空'); 
  		index = 0;
  		return false;
  	}
  	if(password==''){
	  	jQuery(".error").show(200);
	  	jQuery(".error span").html('&nbsp;密码不能为空');
	  	index = 0;
	  	return false; 
  	}
  	userService.getSalt(username,function(data){
  		var pass = hex_md5(password+"{"+data+"}");
  		userdwrutil.login(username,pass,function(result){
  			if(result){
  				window.location.href="/member/t.shtml";
  			}else{
  				jQuery(".error").show(200);
  				jQuery(".error span").html('&nbsp;用户名或密码错误'); 
  			}
  		});
  		});
  	index = 0;
  	return false;
}

function openForgetpassword(){
	$("#forgetPasswordTip").css("visibility","visible");
}
function closeForgetpassword(){
	$("#forgetPasswordTip").css("visibility","hidden");
}
function turn(){
	if($(".profile_1")[0].style.display=="none"){
		$(".profile_2").hide();
		$(".profile_1").show()
	}else{
		$(".profile_1").hide();
		$(".profile_2").show()
	}
}
function search(){
	var word = $("#word").val();
	if(word=="搜索姓名/标签、找人"){
		alert("请输入姓名或标签");
		return;
	}
	$("#searchForm").submit();
}
function textFoucus(type){
	if(type=='name'){
		var name = $("#name").val();
		if(name=="用户名/手机号"){
			$("#name").attr("value","");
		}
	}else if(type=='word'){
		var word = $("#word").val();
		if(word=="搜索姓名/标签、找人"){
			$("#word").attr("value","");
		}
	}
}
function textBlur(type){
	if(type=='name'){
		var name = $("#name").val();
		if(name==""){
			$("#name").attr("value","用户名/手机号");
		}
	}else if(type=='word'){
		var word = $("#word").val();
		if(word==""){
			$("#word").attr("value","搜索姓名/标签、找人");
		}
	}
	
}